<div id="content" class="testd"><br><br>
<h1><?php if($title){ echo $title; } ?></h1><br>
<?php
$logged_in=$this->session->userdata('logged_in');
?>
<?php
if($logged_in['su']=="1"){
?>
<a href="<?php echo site_url('quiz/add_new');?>">Add new</a>
<?php
}
?><div class="wite">
<table id="detail">
<tr><td ><form method="post" action="<?php echo site_url('quiz');?>">
<select name="search_type">
<option value="quiz.quid">ID</option>
<option value="quiz.quiz_name">Quiz Name</option>
<option value="quiz.start_time">Start time</option>
<option value="quiz.end_time">End time</option>
<option value="quiz.duration">Duration</option>
</select>
<input type="text" name="search" value=""> 
<input type="submit" value="Search"></form></td></tr>
</table>
<table id="data_list">
<tr><th>Id</th><th>Quiz name</th><th>Start time</th><th>End time</th><th>Duration</th><th>Action</th></tr>
<?php
if($result==false){
?>
<tr>
<td colspan="5">
No record found!
</td>
</tr>
<?php

}else{
foreach($result as $row){
?>
<tr>
<td><?php echo $row->quid;?></td><td><?php echo $row->quiz_name;?></td><td><?php echo date('Y/m/d',$row->start_time);?></td><td><?php echo date('Y/m/d',$row->end_time);?></td><td><?php echo $row->duration;?> Min. </td><td>
<a href="<?php echo site_url('quiz/attempt/'.$row->quid);?>">Attempt</a>
&nbsp;&nbsp;
<?php
if($logged_in['su']=="1"){
?>
<a href="javascript: if(confirm('Bạn có chắc là muốn xóa không?')){ window.location='<?php echo site_url('quiz/remove_quiz/'.$row->quid );?>'; }"><img src="<?php echo base_url();?>images/cross.png" title="Remove"></a> <a href="<?php echo site_url('quiz/edit_quiz/'.$row->quid );?>"><img src="<?php echo base_url();?>images/edit.png" title="Edit"></a>
<?php
}
?>
</td>
</tr>
<?php
}
}
?>


</table></div>
<br>
<?php
if($logged_in['su']=="1"){
?>
<a href="<?php echo site_url('quiz/add_new');?>"><img src="<?php echo base_url();?>images/plus.png" title="Add new"></a>
&nbsp;&nbsp;
<?php
}
?>
<?php
if(($limit-($this->config->item('number_of_rows')))>=0){ $back=$limit-($this->config->item('number_of_rows')); }else{ $back='0'; } ?>

<a href="<?php echo site_url('quiz/index/'.$back);?>">Back</a>
&nbsp;&nbsp;
<?php
 $next=$limit+($this->config->item('number_of_rows'));  ?>

<a href="<?php echo site_url('quiz/index/'.$next);?>">Next</a>

</div>
